package it.unibo.test.unit;

import static org.junit.Assert.*;
import it.unibo.convoycruisecontrol.boatsubsystem.INavigationInfo;
import it.unibo.convoycruisecontrol.boatsubsystem.SendingNavigationInfo;
import it.unibo.location.ILocation;

import org.junit.BeforeClass;
import org.junit.Test;

public class SendingNavigationInfoTestCase 
{
	static SendingNavigationInfo sending = null;

	static ILocation mockLocation = new ILocation() {

		@Override
		public long getSampleTime() {
			return 0;
		}

		@Override
		public double getLongitude() {
			return 3456.56;
		}

		@Override
		public double getLatitude() {
			return 12398.75;
		}

		@Override
		public double getAltitude() {
			return 0;
		}

		@Override
		public float getAccuracy() {
			return 0;
		}

		@Override
		public float distanceTo(ILocation location) {
			return 0;
		}
	};

	static INavigationInfo mockNavInfo = new INavigationInfo() {

		@Override
		public int getSequencePosition() {
			return 1;
		}

		@Override
		public float getDistanceCovered() {
			return 0;
		}

		@Override
		public float getCurrentSpeed() {
			return (float) 34.6;
		}

		@Override
		public ILocation getCurrentPosition() {
			return mockLocation;
		}
	};

	String info = "info(1,speed(34.6),position(longitude(3456.56),latitude(12398.75))).";

	@BeforeClass
	public static void init()
	{
		try {
			sending = new SendingNavigationInfo(mockNavInfo);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	//TODO Occorre mettere public il metodo createInformations()
	@Test
	public void testCreateInformations() 
	{
		try {
			assertEquals(info, sending.createInformations());
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

}
